<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.3.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"example.com","root":"/","scheme":"Muse","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.json"};
  </script>

  <meta name="description" content="​    这边使用了野火的教程（在这对野火表示感谢）：使得默认情况下优先使用内部 SRAM 空间，在需要的时候使用一个关键字指定变量存储到外部 SDRAM，另外，再把系统默认的堆空间(HEAP)映射到外部 SDRAM，从而可以使用malloc函数动态从SDRAM 中分配空间。 1. 在__main之前初始化SDRAM  2. 修改sct文件​    在sct文件中增加外部 SDRAM 空间对应的执">
<meta property="og:type" content="article">
<meta property="og:title" content="分散加载文件优先用内部SRAM并把堆区分配到SDRAM">
<meta property="og:url" content="http://example.com/2021/03/09/%E5%88%86%E6%95%A3%E5%8A%A0%E8%BD%BD%E6%96%87%E4%BB%B6%E4%BC%98%E5%85%88%E7%94%A8%E5%86%85%E9%83%A8SRAM%E5%B9%B6%E6%8A%8A%E5%A0%86%E5%8C%BA%E5%88%86%E9%85%8D%E5%88%B0%20SDRAM/index.html">
<meta property="og:site_name" content="学无止境">
<meta property="og:description" content="​    这边使用了野火的教程（在这对野火表示感谢）：使得默认情况下优先使用内部 SRAM 空间，在需要的时候使用一个关键字指定变量存储到外部 SDRAM，另外，再把系统默认的堆空间(HEAP)映射到外部 SDRAM，从而可以使用malloc函数动态从SDRAM 中分配空间。 1. 在__main之前初始化SDRAM  2. 修改sct文件​    在sct文件中增加外部 SDRAM 空间对应的执">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210308213446.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210308224219.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210308224959.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210309194605.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210309195141.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210309203307.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210309204823.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210309205449.png">
<meta property="article:published_time" content="2021-03-09T12:59:06.000Z">
<meta property="article:modified_time" content="2021-03-09T12:59:06.000Z">
<meta property="article:author" content="xudonglei">
<meta property="article:tag" content="分散加载文件">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210308213446.png">

<link rel="canonical" href="http://example.com/2021/03/09/%E5%88%86%E6%95%A3%E5%8A%A0%E8%BD%BD%E6%96%87%E4%BB%B6%E4%BC%98%E5%85%88%E7%94%A8%E5%86%85%E9%83%A8SRAM%E5%B9%B6%E6%8A%8A%E5%A0%86%E5%8C%BA%E5%88%86%E9%85%8D%E5%88%B0%20SDRAM/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>分散加载文件优先用内部SRAM并把堆区分配到SDRAM | 学无止境</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">学无止境</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">Do not bb, show me the example</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://example.com/2021/03/09/%E5%88%86%E6%95%A3%E5%8A%A0%E8%BD%BD%E6%96%87%E4%BB%B6%E4%BC%98%E5%85%88%E7%94%A8%E5%86%85%E9%83%A8SRAM%E5%B9%B6%E6%8A%8A%E5%A0%86%E5%8C%BA%E5%88%86%E9%85%8D%E5%88%B0%20SDRAM/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="xudonglei">
      <meta itemprop="description" content="搬砖 嵌入式">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="学无止境">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          分散加载文件优先用内部SRAM并把堆区分配到SDRAM
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-03-09 20:59:06" itemprop="dateCreated datePublished" datetime="2021-03-09T20:59:06+08:00">2021-03-09</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F/" itemprop="url" rel="index"><span itemprop="name">嵌入式</span></a>
                </span>
            </span>

          
            <span id="/2021/03/09/%E5%88%86%E6%95%A3%E5%8A%A0%E8%BD%BD%E6%96%87%E4%BB%B6%E4%BC%98%E5%85%88%E7%94%A8%E5%86%85%E9%83%A8SRAM%E5%B9%B6%E6%8A%8A%E5%A0%86%E5%8C%BA%E5%88%86%E9%85%8D%E5%88%B0%20SDRAM/" class="post-meta-item leancloud_visitors" data-flag-title="分散加载文件优先用内部SRAM并把堆区分配到SDRAM" title="阅读次数">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span class="leancloud-visitors-count"></span>
            </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="fa fa-comment-o"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2021/03/09/%E5%88%86%E6%95%A3%E5%8A%A0%E8%BD%BD%E6%96%87%E4%BB%B6%E4%BC%98%E5%85%88%E7%94%A8%E5%86%85%E9%83%A8SRAM%E5%B9%B6%E6%8A%8A%E5%A0%86%E5%8C%BA%E5%88%86%E9%85%8D%E5%88%B0%20SDRAM/#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/2021/03/09/%E5%88%86%E6%95%A3%E5%8A%A0%E8%BD%BD%E6%96%87%E4%BB%B6%E4%BC%98%E5%85%88%E7%94%A8%E5%86%85%E9%83%A8SRAM%E5%B9%B6%E6%8A%8A%E5%A0%86%E5%8C%BA%E5%88%86%E9%85%8D%E5%88%B0%20SDRAM/" itemprop="commentCount"></span>
    </a>
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p>​    这边使用了野火的教程（在这对野火表示感谢）：使得默认情况下优先使用内部 SRAM 空间，在需要的时候使用一个关键字指定变量存储到外部 SDRAM，另外，再把系统默认的堆空间(HEAP)映射到外部 SDRAM，从而可以使用malloc函数动态从SDRAM 中分配空间。</p>
<h2 id="1-在-main之前初始化SDRAM"><a href="#1-在-main之前初始化SDRAM" class="headerlink" title="1. 在__main之前初始化SDRAM"></a>1. 在__main之前初始化SDRAM</h2><img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210308213446.png" style="zoom:50%;">

<h2 id="2-修改sct文件"><a href="#2-修改sct文件" class="headerlink" title="2. 修改sct文件"></a>2. 修改sct文件</h2><p>​    在sct文件中增加外部 SDRAM 空间对应的执行域：</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210308224219.png" style="zoom:50%;">

<p>​    sct文件中对内部SRAM的执行域保留了默认配置，没有作任何改动，新增了一个外部SDRAM的执行域，并且使用了“*.o(HEAP)”语句把堆区分配到了 SDRAM 空间，使用“.ANY(EXRAM)”语句把名为“EXRAM”的节区分配到 SDRAM 空间。</p>
<h2 id="3-指定变量分配到节区"><a href="#3-指定变量分配到节区" class="headerlink" title="3. 指定变量分配到节区"></a>3. 指定变量分配到节区</h2><p>​    当我们需要把变量分配到外部 SDRAM 时，需要使用__attribute__关键字指定节区：</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210308224959.png" style="zoom:67%;">

<p>​    “_attribute__ ((section (“节区名”)))”描述它要分配到的节区。本例中的节区名为“EXRAM”，即我们在sct 文件中选择分配到SDRAM执行域的节区，所以该变量就被分配到SDRAM中了。</p>
<p>​    根据我们sct文件的配置，如果定义变量时没有指定节区，它会默认优先使用内部SRAM，把变量定义到内部SRAM空间。<strong>而且由于局部变量是属于栈节区(STACK)，它不能使用“_attribute__”关键字指定节区，在本例中的栈节区被分配到内部SRAM空间</strong>。</p>
<h2 id="4-测试程序"><a href="#4-测试程序" class="headerlink" title="4. 测试程序"></a>4. 测试程序</h2><figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//设置变量定义到“EXRAM”节区的宏</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">define</span> __EXRAM __attribute__ ((section (<span class="meta-string">&quot;EXRAM&quot;</span>)))</span></span><br><span class="line"> </span><br><span class="line"><span class="comment">//定义变量到 SDRAM</span></span><br><span class="line"><span class="keyword">uint32_t</span> testValue __EXRAM =<span class="number">7</span>;</span><br><span class="line"><span class="comment">//定义变量到 SRAM</span></span><br><span class="line"><span class="keyword">uint32_t</span> testValue2 =<span class="number">7</span>;</span><br><span class="line"><span class="comment">//定义数组到 SDRAM</span></span><br><span class="line"><span class="keyword">uint8_t</span> testGrup[<span class="number">3</span>] __EXRAM =&#123;<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>&#125;;</span><br><span class="line"><span class="comment">//定义数组到 SRAM</span></span><br><span class="line"><span class="keyword">uint8_t</span> testGrup2[<span class="number">3</span>] =&#123;<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>&#125;;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">(<span class="keyword">void</span>)</span></span></span><br><span class="line"><span class="function"></span>&#123; </span><br><span class="line">	<span class="keyword">uint32_t</span> inerTestValue =<span class="number">10</span>;</span><br><span class="line">	delay_init(<span class="number">168</span>);		 </span><br><span class="line">	LED_Init();		      </span><br><span class="line">	uart_init(<span class="number">115200</span>);</span><br><span class="line">  </span><br><span class="line">	<span class="built_in">printf</span>(<span class="string">&quot;地址：0x%x,  值为：%d\r\n&quot;</span>,(<span class="keyword">uint32_t</span>)&amp;inerTestValue,inerTestValue);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;地址：0x%x,  值为：%d\r\n&quot;</span>,(<span class="keyword">uint32_t</span>)&amp;testValue,testValue);</span><br><span class="line">	<span class="built_in">printf</span>(<span class="string">&quot;地址：0x%x,  值为：%d\r\n&quot;</span>,(<span class="keyword">uint32_t</span>)&amp;testValue2,testValue2);</span><br><span class="line">	<span class="built_in">printf</span>(<span class="string">&quot;地址：0x%x,  值为：%d,%d,%d\r\n&quot;</span>,(<span class="keyword">uint32_t</span>)&amp;testGrup,testGrup[<span class="number">0</span>],testGrup[<span class="number">1</span>],testGrup[<span class="number">2</span>]);</span><br><span class="line">	<span class="built_in">printf</span>(<span class="string">&quot;地址：0x%x,  值为：%d，%d,%d\r\n&quot;</span>,(<span class="keyword">uint32_t</span>)&amp;testGrup2,testGrup2[<span class="number">0</span>],testGrup2[<span class="number">1</span>],testGrup2[<span class="number">2</span>]);</span><br><span class="line">	</span><br><span class="line">	<span class="keyword">uint32_t</span> * pointer = (<span class="keyword">uint32_t</span>*)<span class="built_in">malloc</span>(<span class="keyword">sizeof</span>(<span class="keyword">uint32_t</span>)*<span class="number">3</span>);</span><br><span class="line">	<span class="keyword">if</span>(pointer != <span class="literal">NULL</span>)</span><br><span class="line">	&#123;</span><br><span class="line">		*(pointer)=<span class="number">1</span>;</span><br><span class="line">        *(++pointer)=<span class="number">2</span>;</span><br><span class="line">        *(++pointer)=<span class="number">3</span>; </span><br><span class="line"></span><br><span class="line">		<span class="built_in">printf</span>(<span class="string">&quot;地址为：0x%x\r\n&quot;</span>,(<span class="keyword">uint32_t</span>)pointer); </span><br><span class="line">        <span class="built_in">printf</span>(<span class="string">&quot;*(pointer--)=%d, \r\n&quot;</span>,*(pointer--));</span><br><span class="line">        <span class="built_in">printf</span>(<span class="string">&quot;*(pointer--)=%d, \r\n&quot;</span>,*(pointer--));</span><br><span class="line">        <span class="built_in">printf</span>(<span class="string">&quot;*(pointer)=%d, \r\n&quot;</span>,*(pointer));</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="keyword">while</span>(<span class="number">1</span>)</span><br><span class="line">	&#123;</span><br><span class="line">		GPIO_SetBits(GPIOF , GPIO_Pin_9);</span><br><span class="line">		delay_ms(<span class="number">1000</span>);</span><br><span class="line">		GPIO_ResetBits(GPIOF , GPIO_Pin_9);</span><br><span class="line">		delay_ms(<span class="number">1000</span>);</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>​    查看工程的map文件观察变量的分配情况:</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210309194605.png" style="zoom:80%;">

<p>​    从 map 文件中可看到普通变量及栈节区都被分配到了内部 SRAM 的地址区域，而指定到 EXRAM 节区的变量及堆空间都被分配到了外部 SDRAM 的地址区域，与我们的要求一致。再看串口打印出来的信息如下图所示：</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210309195141.png" style="zoom:67%;">

<h2 id="5-使用malloc和free管理SDRAM的空间"><a href="#5-使用malloc和free管理SDRAM的空间" class="headerlink" title="5. 使用malloc和free管理SDRAM的空间"></a>5. 使用malloc和free管理SDRAM的空间</h2><p>​    SDRAM的内存空间非常大，为了管理这些空间，一些工程师会自己定义内存分配函数来管理SDRAM空间，这些分配过程本质上就是从SDRAM中动态分配内存。我们完全可以直接使用malloc从SDRAM中分配空间，只要在前面配置的基础上修改启动文件中的堆顶地址限制即可。</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210309203307.png" style="zoom:80%;">

<p>​    malloc函数是根据_heap_base及_heap_limit 地址限制分配空间的，在以上的代码定义中，堆基地址_heap_base 的由链接器自动分配未使用的基地址，而堆顶地址_heap_limit 则被定义为外部SDRAM的最高地址 0x68000000+0x00100000(使用这种定义方式定义的__heap_limit 值与 Heap_Size 定义的大小无关)，经过这样配置之后，SDRAM内除 EXRAM 节区外的空间都被分配为堆区，所以malloc函数可以管理剩余的所有 SDRAM空间。修改后，它生成的 map文件信息如下图所示：</p>
<p><img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210309204823.png"></p>
<p><img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210309205449.png"></p>
<p>​    可看到_heap_base 的地址紧跟在 EXRAM 之后，__heap_limit 指向了 SDRAM 的最高</p>
<p>地址，因此 malloc 函数就能利用所有 SDRAM 的剩余空间了。注意图中显示的 HEAP 节区大小为 0x00000200 字节，修改启动文件中的 Heap_Size 大小可以改变该值，<strong>它的大小是不会影响 malloc 函数使用的</strong>，malloc 实际可用的就是_heap_base 与__heap_limit 之间的空间。</p>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/%E5%88%86%E6%95%A3%E5%8A%A0%E8%BD%BD%E6%96%87%E4%BB%B6/" rel="tag"># 分散加载文件</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2021/03/07/esp32%E5%B0%81%E8%A3%85lib%E5%BA%93/" rel="prev" title="esp32封装lib库">
      <i class="fa fa-chevron-left"></i> esp32封装lib库
    </a></div>
      <div class="post-nav-item">
    <a href="/2021/03/10/OpenOCD%E5%BC%80%E6%BA%90%E8%B0%83%E8%AF%95%E5%99%A8%E5%9C%A8windows%E4%B8%8A%E4%BD%BF%E7%94%A8/" rel="next" title="OpenOCD开源调试器在windows上使用">
      OpenOCD开源调试器在windows上使用 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E5%9C%A8-main%E4%B9%8B%E5%89%8D%E5%88%9D%E5%A7%8B%E5%8C%96SDRAM"><span class="nav-number">1.</span> <span class="nav-text">1. 在__main之前初始化SDRAM</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E4%BF%AE%E6%94%B9sct%E6%96%87%E4%BB%B6"><span class="nav-number">2.</span> <span class="nav-text">2. 修改sct文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E6%8C%87%E5%AE%9A%E5%8F%98%E9%87%8F%E5%88%86%E9%85%8D%E5%88%B0%E8%8A%82%E5%8C%BA"><span class="nav-number">3.</span> <span class="nav-text">3. 指定变量分配到节区</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-%E6%B5%8B%E8%AF%95%E7%A8%8B%E5%BA%8F"><span class="nav-number">4.</span> <span class="nav-text">4. 测试程序</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-%E4%BD%BF%E7%94%A8malloc%E5%92%8Cfree%E7%AE%A1%E7%90%86SDRAM%E7%9A%84%E7%A9%BA%E9%97%B4"><span class="nav-number">5.</span> <span class="nav-text">5. 使用malloc和free管理SDRAM的空间</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">xudonglei</p>
  <div class="site-description" itemprop="description">搬砖 嵌入式</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">283</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">19</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">67</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2024</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">xudonglei</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://muse.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a> 强力驱动
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>




  




  
<script src="/js/local-search.js"></script>













  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : false,
      appId      : 'BT0Qw9HcTpPv1a6cT1iDBXKz-gzGzoHsz',
      appKey     : 'LMCMh8v02JTMFAwKNRcgoizI',
      placeholder: "Just go go",
      avatar     : 'mm',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : true,
      lang       : 'zh-CN' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>

</body>
</html>
